const { rpc } = require('../../utils/util.js')
const service = require('./service.js')
const { format } = require('../../utils/util.js')
const regeneratorRuntime = require('../../utils/async.js')
const app = (module.exports = {})

app.getContent = async (params, action, state) => {
  const { id } = params
  const serv = { ...service.getShares }
  const result = await rpc(((serv.url += id), serv)) 

  await action.setData({
    ...result,
    published: format(new Date(result.published), 'yyyy-MM-dd'),
    showLoading: false
  })
}
